﻿
using Irony.Compiler;

namespace IronLua.Ast {

	public class VariableExpression : Expression {

		readonly string name;

		public string Name {
			get { return name; }
		}

		public override LuaNodeType NodeType {
			get { return LuaNodeType.VariableExpression; }
		}

		public VariableExpression (CompilerContext context, NonTerminal nonTerminal, SourceLocation location, AstNodeList childNodes)
			: base (context, nonTerminal, location, childNodes)
		{
		}

		public VariableExpression (AstNode node) :
			base (null, node.Element as NonTerminal, node.Location, new AstNodeList ())
		{
			name = ((Token) node).Text;
		}

		public override void Accept (ILuaAstVisitor visitor)
		{
			visitor.VisitVariableExpression (this);
		}
	}
}
